package com.zzq.controller;

import com.zzq.domain.entity.SmilePointRule;
import com.zzq.domain.search.PointRuleSearchParamet;
import com.zzq.result.SmileResult;
import com.zzq.service.PointRuleAdminService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/admin/point/rule")
@Api(value = "积分来源管理",tags = {"积分来源管理"})
public class PointRuleAdminController {

    @Autowired
    PointRuleAdminService ruleAdminService;
    @PostMapping("/add")
    @ApiOperation("添加积分来源规则")
    public SmileResult add(@RequestBody  SmilePointRule pointRule){
      return   ruleAdminService.add(pointRule);
    }

    @PostMapping("/upd")
    @ApiOperation("更新积分来源规则")
    public SmileResult upd(@RequestBody  SmilePointRule pointRule){
        return   ruleAdminService.upd(pointRule);
    }
    @PostMapping("/list")
    @ApiOperation("获取积分来源列表")
    public SmileResult list(@RequestBody PointRuleSearchParamet searchParamet){
        return   ruleAdminService.list(searchParamet);
    }
    @GetMapping("/del")
    @ApiOperation("删除")
    public SmileResult del(@RequestParam("pointRuleId") Long pointRuleId){
        return   ruleAdminService.del(pointRuleId);
    }

}
